package org.example.demo.controller.sellerController;

import org.example.demo.dto.sellerAccount.SellerAccountLoginParam;
import org.example.demo.service.sellerService.sellerAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class sellerAccountController {
    @Autowired
    private sellerAccountService sellerService;

    @RequestMapping("/seller/account/login")
    @ResponseBody
    SellerAccountLoginParam login(String loginName, String loginPwd) {
//        if (!sellerService.exist(loginName)) return -1L;
        if (!sellerService.exist(loginName)) sellerService.register(loginName, loginPwd);
        return sellerService.login(loginName, loginPwd);
    }

    @RequestMapping("/seller/account/register")
    @ResponseBody
    Long register(String name, String password) {
//        创建卖家账号信息，然后创建一个商铺
        if (sellerService.exist(name)) return -1L;
        return sellerService.register(name, password);
    }

    @RequestMapping("/seller/order/list")
    @ResponseBody
    String listOrder(String name, String password) {
        return "";

    }

    @RequestMapping("/seller/order/search")
    @ResponseBody
    String searchOrder(String name, String password) {
        return "";

    }

    @RequestMapping("/seller/order/delete")
    @ResponseBody
    String deleteOrder(String name, String password) {
        return "";

    }

    @RequestMapping("/seller/order/alter")
    @ResponseBody
    String alterOrder(String name, String password) {
        return "";

    }

    @RequestMapping("/seller/order/add")
    @ResponseBody
    String addOrder(String order) {
        return "";


    }
}
